/*
** Copyright (C) 2009 Joshua Brent Marsh <joshua@icub3d.com>
**
** This file is part of icub3d-adt  
**
** icub3d-adt is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
**  
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**  
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**  
*/

/* $Id: set.h 14 2009-10-15 04:47:03Z joshua@icub3d.com $ */

#ifndef ICUB3D_SET_H
#define ICUB3D_SET_H 1

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdlib.h>

#include "function_prototypes.h"
#include "btree.h"

typedef Btree Set;
typedef BtreeTraverser SetTraverser;

#define set_create(comp) (btree_create (comp, RB))
#define set_destroy btree_destroy
#define set_size btree_size
#define set_empty(set) (set_size (set) == 0)

#define set_add btree_insert
#define set_search btree_find
#define set_remove btree_remove
#define set_exists(set, item) (set_search (set, item) == NULL ? 0 : 1)

int set_subset (Set *, Set *);
#define set_contains(set1, set2) (set_subset (set2, set1))
int set_equal (Set *, Set *);
int set_distinct (Set *, Set *);
Set * set_union (Set *, Set *);
Set * set_intersect (Set *, Set *);
Set * set_difference (Set *, Set *);

#define set_traverser_init btree_traverser_init
#define set_traverser_cur btree_traverser_cur
#define set_traverser_first btree_traverser_first
#define set_traverser_last btree_traverser_last
#define set_traverser_next btree_traverser_next
#define set_traverser_prev btree_traverser_prev

#endif /* ICUB3D_SET_H */
